package be.ac.ua.pats.thesisrobotica.robot.main;

//~--- non-JDK imports --------------------------------------------------------


import lejos.nxt.Button;
import lejos.nxt.ButtonListener;
import lejos.nxt.comm.RConsole;

/**
 * The driver, please note that the RConsole commands are for debugging purpose and will be removed in a later stage.
 *
 * @author Jimmy
 */
public class Driver {
    public static void main(String args[])  {

        try {
            // Initializing the external console.
            Button.ESCAPE.addButtonListener(new ButtonListener() {

                public void buttonPressed(Button button) {
                    System.exit(1);
                }

                public void buttonReleased(Button button) {
                }

            });
            RConsole.openUSB(20000);
            Robot robot = new Robot();
            robot.initialize();
            //robot.printStatus();
            robot.connect();
            Thread.currentThread().join();
            // Closing the external console.
            RConsole.close();
        } catch (InterruptedException ex) {
            RConsole.println("InterruptedException");
        }
    }
}
